package com.qingke.qkmall.controller;

public class Test {
	private static int money = 1000;
	private boolean flag = false;
	public static void main(String[] args) {
		Test t = new Test();
		Runnable ra = new Runnable() {
			public void run() {
				money+=100;
			}
		};
		
		Runnable rb = new Runnable() {
			public void run() {
				money+=100;
			}
			
		};
		Thread t1 = new Thread(ra,"t1线程");
		Thread t2 = new Thread(rb,"t2线程");
		
		t1.start();
		t2.start();
	}
	
	public synchronized void fun1() {
		for(int i = 0 ; i < 1000; i++) {
			try {
				Thread.sleep(3000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			if(flag) {
				
			}
			
			System.out.println(Thread.currentThread().getName()+":"+money);
		}
	}
	


}
